Hệ thống quản lý phòng khám trực tuyến bằng PHP

1 <?php
2 /*
3  * Get calendar full HTML
4  */

5
6 function getCalender($year =
'', $month = '') {
7     $dateYear = ($year !=
'') ? $year : date("Y");
8     $dateMonth = ($month !=
'') ? $month : date("m");
9     $date = $dateYear .
'-' . $dateMonth . '-01';
10     $currentMonthFirstDay = date(
"N", strtotime($date));
11     $totalDaysOfMonth = cal_days_in_month(CAL_GREGORIAN, $dateMonth, $dateYear);
12     $totalDaysOfMonthDisplay = ($currentMonthFirstDay ==
7) ? ($totalDaysOfMonth) : ($totalDaysOfMonth + $currentMonthFirstDay);
13     $boxDisplay = ($totalDaysOfMonthDisplay <=
35) ? 35 : 42;
14     ?>
15
16
17
18     <div style=
"margin-top: 20px" > <a href="../index.php" class="btn btn-info" role="button">Back to Home Page</a></div>
19
20
21
22     <div
class="container text-center">
23
24         <div
class="row">
25             <div
class="col-lg-8 col-sm-12 col-xs-12" style="margin-right: 0px">
26                 <div id=
"calender_section">
27                     <h2>
28                         <a href=
"javascript:void(0);" onclick="getCalendar('calendar_div', '<?php echo date("Y", strtotime($date . ' - 1 Month')); ?>', '<?php echo date("m", strtotime($date . ' - 1 Month')); ?>');">&lt;&lt;</a>
29                         <
select name="month_dropdown" class="month_dropdown dropdown"><?php echo getAllMonths($dateMonth); ?></select>
30                         <
select name="year_dropdown" class="year_dropdown dropdown"><?php echo getYearList($dateYear); ?></select>
31                         <a href=
"javascript:void(0);" onclick="getCalendar('calendar_div', '<?php echo date("Y", strtotime($date . ' + 1 Month')); ?>', '<?php echo date("m", strtotime($date . ' + 1 Month')); ?>');">&gt;&gt;</a>
32                     </h2>
33
34                     <div id=
"calender_section_top">
35                         <ul>
36                             <li>Sun</li>
37                             <li>Mon</li>
38                             <li>Tue</li>
39                             <li>Wed</li>
40                             <li>Thu</li>
41                             <li>Fri</li>
42                             <li>Sat</li>
43                         </ul>
44                     </div>
45                     <div id=
"calender_section_bot">
46                         <ul>
47     <?php
48     $dayCount =
1;
49     
for ($cb = 1; $cb <= $boxDisplay; $cb++) {
50         
if (($cb >= $currentMonthFirstDay + 1 || $currentMonthFirstDay == 7) && $cb <= ($totalDaysOfMonthDisplay)) {
51             
//Current date
52             $currentDate = $dateYear .
'-' . $dateMonth . '-' . $dayCount;
53             $eventNum =
0;
54
55             $result = sql(
"SELECT title FROM events WHERE date = '" . $currentDate . "' AND status = 'Active'", $e0);
56             $eventNum = $result->num_rows;
57             
//Define date cell color
58             
if (strtotime($currentDate) == strtotime(date("Y-m-d")) ) {
59                 
60                 
61                 
if ($eventNum > 0){
62                 
63             
64                 
65                 echo
'<li date="' . $currentDate . '" class="grey date_cell">'.'<span>'.$dayCount.'</span>'.'<a href="javascript:;" onclick=" getEvents(\'' . $currentDate . '\');">Appt. (' . $eventNum . ')</a>';;
66                 
67                 }
else {
68                     echo
'<li date="' . $currentDate . '" class="grey date_cell">'.'<span>'.$dayCount.'</span>';
69                 }
70                 
71                 
72                 
73             } elseif ($eventNum >
0) {
74                 echo
'<li date="' . $currentDate . '" class="light_sky date_cell">'.'<span>'.$dayCount.'</span>'.'<a href="javascript:;" onclick=" getEvents(\'' . $currentDate . '\');">Appt. (' . $eventNum . ')</a>';
75             }
else {
76                 echo
'<li date="' . $currentDate . '" class="date_cell">'.'<span>'. $dayCount.'</span>';
77             }
78
79             echo
'</li>';
80             $dayCount++;
81             ?>
82                                 <?php }
else { ?>
83                                     <li><span>&nbsp;</span></li>
84                                 <?php }
85                             }
86                             ?>
87                         </ul>
88                     </div>
89                 </div>
90             </div>
91
92             <div
class="col-xs-8 col-lg-4">
93
94                 <div id=
"event_list" class="none"></div>
95             </div>
96         </div>
97     </div>
98     <script>
99         $j(document).ready(function () {
100             $j(
'.date_cell').mouseenter(function () {
101                 date = $j(
this).attr('date');
102                 $j(
".date_popup_wrap").fadeOut();
103                 $j(
"#date_popup_" + date).fadeIn();
104             });
105             $j(
'.date_cell').mouseleave(function () {
106                 $j(
".date_popup_wrap").fadeOut();
107             });
108             $j(
'.month_dropdown').on('change', function () {
109                 getCalendar(
'calendar_div', $j('.year_dropdown').val(), $j('.month_dropdown').val());
110             });
111             $j(
'.year_dropdown').on('change', function () {
112                 getCalendar(
'calendar_div', $j('.year_dropdown').val(), $j('.month_dropdown').val());
113             });
114             $j(document).click(function () {
115                 $j(
'#event_list').show();
116             });
117         });
118     </script>
119
120     <?php
121 }

122
123 /*
124  * Get months options list.
125  */

126
127 function getAllMonths($selected =
'') {
128     $options =
'';
129     
for ($i = 1; $i <= 12; $i++) {
130         $
value = ($i < 10) ? '0' . $i : $i;
131         $selectedOpt = ($
value == $selected) ? 'selected' : '';
132         $options .=
'<option value="' . $value . '" ' . $selectedOpt . ' >' . date("F", mktime(0, 0, 0, $i + 1, 0, 0)) . '</option>';
133     }
134     
return $options;
135 }

136
137 /*
138  * Get years options list.
139  */

140
141 function getYearList($selected =
'') {
142     $options =
'';
143     
for ($i = 2015; $i <= 2025; $i++) {
144         $selectedOpt = ($i == $selected) ?
'selected' : '';
145         $options .=
'<option value="' . $i . '" ' . $selectedOpt . ' >' . $i . '</option>';
146     }
147     
return $options;
148 }

149
150 /*
151  * Get events
by date
152  *
select * from event where date="2016-08-08" AND status = "Active" ORDER BY time
153  */

154
155 function getEvents($date =
'') {
156     $eventListHTML =
'';
157     $date = $date ? $date : date(
"Y-m-d");
158     
//Get events based on the current date
159 //include
'dbConfig.php';
160     
161     $result = sql(
"SELECT * FROM events WHERE date = '" . $date . "' AND status = 'Active' ORDER BY time ", $e0);
162     
if ($result->num_rows > 0) {
163         
164         $eventListHTML .=
'<h3>' . date("l, d M Y", strtotime($date)) . '</h3>';
165         $eventListHTML .=
'<ul class="text-left">';
166
167         
while ($row = $result->fetch_assoc()) {
168             $name = sql(
"select first_name from patients where id='" . $row['name_patient'] . "'", $e0);
169             
if ($row_name = $name->fetch_assoc()) {
170                 $s = config(
"adminConfig");
171
172                 $eventListHTML .=
"<li>" . $row['title'] . " of " . $row_name['first_name'] . " at " . date(substr($s['PHPDateTimeFormat'], 7), strtotime($row['time'])) . "</li>";
173             }
174         }
175         $eventListHTML .=
'</ul>';
176     }
177     echo $eventListHTML;
178 }
179 ?>
180
181 <?php
//include_once("$currDir/footer.php"); ?>


Gõ tìm kiếm nhanh...